package eerbaar.v2.menu;

import java.util.ArrayList;
import java.util.List;

import eerbaar.v2.app.menu.IMenuItem;
import eerbaar.v2.app.menu.IMenuProvider;

public class PetMenuProvider implements IMenuProvider {

    public static final String PET_MENU = "petMenu";
    private static final PetMenuProvider instance = new PetMenuProvider();

    public static PetMenuProvider getInstance() {
        return instance;
    }

    private final List<MenuItem> menus = new ArrayList<MenuItem>();

    private PetMenuProvider() {
        //
    }

    @Override
    public void addMenuItem(IMenuItem menu) {
        if (!this.menus.contains(menu)) {
            this.menus.add((MenuItem) menu);
        }
    }

    @Override
    public String getId() {
        return PET_MENU;
    }

    public MenuItem[] getMenuItems() {
        return this.menus.toArray(new MenuItem[] {});
    }

    @Override
    public void removeMenuItem(IMenuItem menu) {
        if (this.menus.contains(menu)) {
            this.menus.remove(menu);
        }
    }

}
